package cjq.demo.thread.ch4_10;

import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;

/**
 * Created by Administrator on 2016/4/30.
 */
public class ResultTask extends FutureTask<String> {

    private String name;

    public ResultTask(Callable<String> callable){
        super(callable);
        this.name = ((ExecutableTask)callable).getName();
    }


    protected void done(){
        if(isCancelled()){
            System.out.println(name+" : Has bean canceled ");
        }else{
            System.out.println(name+ " : Has finished ");
        }
    }
}
